package com.banksoft.cps.service.impl;

import com.banksoft.cps.bean.FileInfo;
import com.banksoft.cps.dao.FileInfoDao;
import com.banksoft.cps.service.FileInfoService;
import com.banksoft.cps.util.UUIDFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by rongzhao.zhu on 2018/1/9.
 */
@Service
public class FileInfoServiceImpl implements FileInfoService {

    @Autowired
    FileInfoDao fileInfoDao;

    public void saveFile(FileInfo fileInfo)
    {
        fileInfo.setId(UUIDFactory.random());
        this.fileInfoDao.saveFileInfo(fileInfo);
    }

    public void deleteFile(String fileId)
    {
        this.fileInfoDao.deleteFileInfo(fileId);
    }

    public FileInfo queryFile(String fileId) {
        FileInfo fileInfo = this.fileInfoDao.queryFile(fileId);
        return fileInfo;
    }

    public List<FileInfo> queryFile(List<String> fileIds) {
        return this.fileInfoDao.queryFiles(fileIds);
    }
}
